package com.my.study.handler;

import com.my.study.utils.PropertiesUtil;
import org.springframework.stereotype.Component;

import java.util.*;

@Component
public class RedisConfigHandler {

    private static List<Map<String,String>> nodes = new ArrayList<>();

    static{
        Properties properties = PropertiesUtil.readProperties("redis-properties.properties");
        String node = properties.getProperty("node");
        List<String> list = Arrays.asList(node.split(","));
        list.forEach(str -> {
            Map<String,String> nodeMap = new HashMap<>();
            nodeMap.put("ip",str.split(":")[0]);
            nodeMap.put("port",str.split(":")[1]);
            nodes.add(nodeMap);
        });
    }
}
